package com.llseven.ai.spring.llseven.controller;


import com.llseven.ai.spring.llseven.model.QiNiuModel;
import com.llseven.ai.spring.llseven.model.ResultModel;
import com.llseven.ai.spring.llseven.service.QiniuService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ywb
 * @date 2022-09-28 10:08
 */
@RestController
public class FileUpLoadController {
    
    final QiniuService qiniuService;
    
    public FileUpLoadController(QiniuService qiniuService) {
        this.qiniuService = qiniuService;
    }
    
    @GetMapping("/qiniu/token")
    public ResultModel<QiNiuModel> getToken() {
        QiNiuModel qiNiuModel = new QiNiuModel(
            qiniuService.getUploadToken(null),
            "",
           "http://suwchu9pz.hn-bkt.clouddn.com/"
        );
        return ResultModel.success(qiNiuModel);
    }
}
